<template>
	<view class="content">
		<view class="phone">
			<view class="left">
				<image style="width: 51rpx; height: 49rpx;margin-right: 30rpx;" src="/static/image/call.png" mode="">
				</image>
				<text style="font-size: 34rpx;font-weight: bold;color: #333333;">{{unmber}}</text>
			</view>
			<view class="right">
				<text @click="makePhoneCalls" class="color">专属顾问，点击拨打</text>
			</view>
		</view>
		<view class="ewm">
			<view class="color">点击识别二维码，在线联系客服</view>
			<image @tap="see" style="width: 248rpx;height: 241rpx; margin-top: 50rpx;" :src="img" mode="">
			</image>
			<view class="copy">
				<text>微信号：{{num}}</text>
				<image @tap="copy" style="width: 22rpx; height: 24rpx; vertical-align: middle;"
					src="../../static/image/copy.png" mode=""></image>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				unmber:'',
				img:'',
				num:''
			};
		},
		onLoad() {
		this.kefu()	
		this.erweima()
		this.whertNum()
		},
		methods: {
			see() {
				var imgArr = [];
				imgArr.push(this.img);
				console.log(imgArr)
				uni.previewImage({
					urls: imgArr,
					itemList: ['发送给朋友', '保存图片', '收藏']
				})
			},
			makePhoneCalls() {
				uni.makePhoneCall({
					phoneNumber: this.unmber // 替换为你要拨打的电话号码
				});
			},
			async kefu(){
				const res = await this.$u.api.kefu({code:'ABOUT_PHONE'})
				this.unmber = res.description
			},
			async erweima (){
				const res = await this.$u.api.kefu({code:'SERVICE_CODE'})
				this.img = res.description
			},
			async whertNum (){
				const res = await this.$u.api.kefu({code:'SERVICE_WX_CODE'})
				this.num = res.description
			},
			copy() {
				console.log(11);
				var that = this;
				uni.setClipboardData({
					data: that.num,
					success(res) {
						uni.showToast({
							title: '复制成功',
						})
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f0f2f5 !important;
	}

	.color {
		font-size: 28rpx;
		font-family: PingFang SC;
		font-weight: bold;
		color: #FF6B55;
	}

	.content {
		padding: 30rpx 30rpx;

		.phone {
			padding: 0 39rpx 0 28rpx;
			height: 150rpx;
			background: #FFFFFF;
			border-radius: 20rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;

			.left {
				display: flex;
				align-items: center;
			}
		}

		.ewm {
			padding: 55rpx 0 50rpx;
			text-align: center;
			margin-top: 25rpx;
			height: 495rpx;
			background: #FFFFFF;
			border-radius: 20rpx;

			.copy {
				margin-top: 40rpx;
				display: flex;
				align-items: center;
				justify-content: center;

				image {
					margin-left: 22rpx;
				}
				view{
					font-family: PingFang SC;
					font-weight: 500;
					color: #333333;
				}
			}
		}
	}
</style>